<template>
  <div class="slide">
    <swiper ref="mySwiper" :options="swiperOptions">
      <swiper-slide class="swiper-slide" v-for="(item, index) in heaSlide" :key="index">
        <img :src="item.imgUrl" class="swiper_img" alt="" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'

import 'swiper/css/swiper.css'
// 通过路由判断是那边的轮播图
export default {
  name: 'Slide',
  data() {
    return {
      swiperOptions: {
        autoplay: true,
        loop: true,
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
        },
      },
    }
  },
  props: {
    heaSlide: {
      type: Array,
      require: true,
      default: function () {
        return []
      },
    },
    // detailSlide: {
    //   type: Array,
    //   require: true,
    //   default: function () {
    //     return []
    //   },
    // },
  },
  components: {
    Swiper,
    SwiperSlide,
  },
}
</script>

<style lang="scss" scoped>
.slide {
  width: 100%;
  .swiper_img {
    width: 750px;
    height: 100%;
    object-fit: cover;
  }
}
</style>
